gtk-demo: Fix keynav in the puzzle
authorMatthias Clasen <mclasen@redhat.com>
Mon, 1 Jun 2020 04:09:52 +0000 (00:09 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 1 Jun 2020 04:11:43 +0000 (00:11 -0400)
We need to make shortcut controller have global
scope, otherwise the shortcuts lose against the
window keybindings.

demos/gtk-demo/sliding_puzzle.c

index 3f1a7c30927eebd61f85f4caaca19b2fb7451d11..925d9817642b75559124c494f015ffe4c5fdce76 100644 (file)
@@ -293,6 +293,8 @@ start_puzzle (GdkPaintable *paintable)
   /* Add shortcuts so people can use the arrow
    * keys to move the puzzle */
   controller = gtk_shortcut_controller_new ();
+  gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
+                                     GTK_SHORTCUT_SCOPE_GLOBAL);
   add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
                     GDK_KEY_Left, GDK_KEY_KP_Left,
                     -1, 0);